package blog

const base_html = `<!DOCTYPE html>
<html>
{{template "head" .}}
<body class="home blog" onload="">
	{{template "bloghead"}}
	<div id="wrap">
		{{template "menu"}}
		<div id="toolbar">
			<div id="rss"><a href="http://blog.rqhut.net/rss" title="RSS Feed">RSS</a></div>
			<form id="searchform" method="get" action="">
				<input type="text" value="" name="s" id="s" size="30" placeholder="Search"/>
				<button type="submit">Search</button>
			</form>
		</div>
		{{template "content" .}}		
	</div>
	{{template "module"}}
	{{template "foot"}}
</body>
</html>
`

const common_html = `
{{define "head"}}
<head>
	<meta charset="UTF-8" />
	<title>Blog@RqHuT</title>
	<link rel="stylesheet" href="/static/css/style.css"/>
	<script src="/static/js/jquery-1.7.2.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="/static/google-code-prettify/prettify.js"></script>
	<script type="text/javascript" src="/static/google-code-prettify/lang-go.js"></script>
	<link href="/static/google-code-prettify/prettify.css" type="text/css" rel="stylesheet" />
	<link rel="alternate" type="application/rss+xml" title="hongrq's Blog RSS Feed" href="http://blog.rqhut.net/rss"/>
	<link rel="self" type="application/atom+xml" href="http://blog.rqhut.net/atom"/>
	<script>
	$().ready(function(){
		prettyPrint();
		$("#searchform").submit(function(){
			s = $("#searchform input").attr("value");
			window.open("http://www.google.com/cse?cx=016974007957223551074:yg9nvwqx9fm&q=1#gsc.tab=0&gsc.q=" + s);
			return false;
		});
	});
	</script>
	<!--[if lt IE 9]>
		<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<meta name="description" content="blog@rqhut"/>
	<meta name="keywords" content="golang python c"/>
	{{template "js" .}}
	<script type="text/javascript">

	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-31491066-1']);
	  _gaq.push(['_trackPageview']);

	  (function() {
	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();

	</script>
</head>
{{end}}
{{define "js"}}
{{end}}
{{define "bloghead"}}
	<header id="header">
		<hgroup>
			<h1 id="logo"><a href="http://blog.rqhut.net/">Blog@RqHuT</a></h1>
			<h2>Qi 开始写博客了哇</h2>
		</hgroup>
	</header>
{{end}}
{{define "menu"}}
		<nav id="menu">
			<ul id="menu-header" class="nav">
				<li class="">
					<a title="首页" href="/">首页</a>
				</li>
				<li class="">
					<a title="技术" href="/cate/技术">技术</a>
				</li>
				<li class="">
					<a title="开源" href="/cate/开源">开源</a>
				</li>
				<li class="">
					<a title="翻译" href="/cate/翻译">翻译</a>
				</li>
				<li class="">
					<a title="碎片" href="/cate/碎片">碎片</a>
				</li>
				<li class="">
					<a title="Go语言" href="/cate/Go语言">Go语言</a>
				</li>
				<li class="">
					<a title="互联网" href="/cate/互联网">互联网</a>
				</li>
				<li class="">
					<a title="吹水" href="/cate/吹水">吹水</a>
				</li>
			</ul>
		</nav>
{{end}}
{{define "module"}}
{{end}}
{{define "foot"}}
	<footer id="footer">
		<p>&copy; 2012 Blog@RqHuT. Powered by <a href="http://golang.org/" target="_blank">golang</a>. Theme by <a href="http://www.prower.cn" target="_blank">Prower</a>.</p>
	</footer>
{{end}}
`

const articlelist_html = `
{{define "content"}}
		<div id="content">
			<article id="post_list">
				{{$global := .}}
				{{range .Articles}}
				<section class="post">
					<h2><a href="/article/{{.Title}}">{{.Title}}</a>{{if .IsDraft}}[Draft]{{end}}</h2>
					<small class="meta">{{.Date}}</small>
					{{.RawContent}}
					<p>
					{{if $global.IsAdmin}}
						<a href="/edit/{{.Title}}">编辑</a>|
						<a href="/delete/{{.Title}}">删除</a>|
					{{end}}
						<a href="/article/{{.Title}}" class="more-link">阅读全文 &raquo;</a>
					</p>
				</section>
				{{end}}
			</article>
			<nav class="navigation">
				{{if .Prev}}
				<span class="alignleft"><a href="/?page={{.Prev}}" >&laquo;上一页</a></span>
				{{end}}
				{{if .Next}}
				<span class="alignright"><a href="/?page={{.Next}}" >下一页 &raquo;</a></span>
				{{end}}
			</nav>
		</div>
{{end}}
{{define "module"}}
<aside id="footer_box">
	<div id="linkcat">
		<a href="http://pangcong.net/" title="pangcong'blog">pangcong'blog</a>
		<a href="http://melkor.me/" title="melkor'blog">melkor'blog</a>
		<a href="http://www.rwnest.com/" title="荣文'blog">荣文'blog</a>
		<a href="http://blog.irix.me/" title="菊花哥'blog">菊花哥'blog</a>
		<a href="http://www.100steps.net/" title="百步梯">百步梯</a>
	</div>
</aside>
{{end}}
{{define "js"}}
	<script>
	$().ready(function(){
	{{if .Cate}}
	$("a[title='{{.Cate}}']").parent("li").addClass("current-menu-item");
	{{else}}
	$("a[title='首页']").parent("li").addClass("current-menu-item");
	{{end}}
	});
	</script>
{{end}}
`

const article_html = `
{{define "content"}}
		<div id="content">	
			<article class="post">
				<h1>{{.Article.Title}}{{if .IsAdmin}}<a href="/edit/{{.Article.Title}}">[编]</a>{{end}}</h1>
				<small class="meta">{{.Article.Date}}</small>
				{{.Article.RawContent}}
				<small class="meta">分类：{{range .Article.Cates}}<a href="/cate/{{.}}">{{.}} </a>{{end}}</small>
			</article>
			本<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" rel="dct:type">作品</span>采用<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/">知识共享署名-非商业性使用 3.0 Unported许可协议</a>进行许可。
			<article id="comments">
				<h3>{{len .comments}} 条评论</h3>				
				<ol class="comment_list">
					{{range .comments}}
					<li>
						<div>
							<div class="comment-author vcard">
								<img alt='' src='{{gravatar .Email}}' class='avatar avatar-24 photo' height='24' width='24' />		
								<cite>{{if .Url}}<a href="{{.Url}}">{{end}}{{.Author}}{{if .Url}}</a>{{end}}</cite><span class="says">说道：</span>		
							</div>
							<div class="comment-meta">{{.Date}}</div>
							<p>{{.CommentString}}</p>
						</div>
					</li>
					{{end}}
				</ol>
				<div id="respond">
					<h3 id="reply-title">发表评论</h3>
					<form action="/comment" method="post" id="commentform">
						{{if .User}}
						<p class="comment-notes">电子邮件地址不会被公开。 必填项已用 <span class="required">*</span> 标注</p>							
						<p class="comment-form-author"><label for="author">姓名</label><span class="required">*</span>
						<input id="author" name="author" type="text" value="" size="30" aria-required='true' /></p>
						<p class="comment-form-email"><label for="email">电子邮件</label><span class="required">*</span>
						<input id="email" name="email" type="text" value="{{.User.Email}}" disabled="disabled" size="30" aria-required='true' /></p>
						<p class="comment-form-url"><label for="url">站点</label><input id="url" name="url" type="text" value="" size="30" /></p>
						<p class="comment-form-comment"><label for="comment">评论</label>
						<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>											
						<p class="form-submit">
							<input name="submit" type="submit" id="submit" value="发表评论"/>
							<input type='hidden' name='article' value='{{.Article.Title}}'/>
						</p>
						{{else}}
						<p class="comment-notes"><a href="{{.LoginURL}}">请使用Google帐号登录后进行评论。</a></p>	
						{{end}}												
					</form>
				</div>
			</article>
		</div>
{{end}}
{{define "js"}}
<script>
$().ready(function(){
	$(".comment_list li:odd").addClass("thread-odd");
});
</script>
{{end}}
`

const articleedit_html = `
{{define "content"}}
		<div id="content">
			<h1>编辑文章</h1>
			<p></p>
			<form method="POST" action="">
			<p><label for="title">标题: </label><input type="text" name="title" value="{{.Title}}" style="width:300px"/>
			   <input type="checkbox" name="IsDraft" {{if .IsDraft}}checked="checked"{{end}} style="margin-left:5px;"/></p>
			<p><label for="cates">分类: </label><input type="text" name="cates" value="{{.CateString}}" style="width:300px"/></p>
			<textarea name="content" class="xheditor {tools:'full',width:'500',height:'400',internalScript:true,inlineScript:true,linkTag:true,urlType:'root',upLinkUrl:'/upload',upImgUrl:'/upload',upFlashUrl:'/upload',upMediaUrl:'/upload', html5Upload:false}">{{.ContentString}}</textarea>
			<input type="submit" value="发表"/>
			<form>
		</div>
{{end}}
{{define "js"}}
<script src="/static/xheditor-1.1.13/xheditor-1.1.13-zh-cn.min.js" type="text/javascript"></script>
{{end}}
`